package net.pimpas.report.processor.condition.impl;

import net.pimpas.report.processor.condition.AbstractCondition;
import net.pimpas.report.processor.condition.ConditionType;
import net.pimpas.report.processor.exception.ConditionException;
import net.pimpas.report.processor.field.Field;
import net.pimpas.report.processor.resolver.FieldPropertyResolver;

import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;

public class IsNullCondition extends AbstractCondition {

	/**
	 * 
	 */
	private static final long serialVersionUID = -9125118379779497313L;

	public IsNullCondition(Field field) {
		super(field, ConditionType.IS_NULL);
	}

	@Override
	public Criterion process(String fieldAlias, FieldPropertyResolver resolver) throws ConditionException {
		return Restrictions.isNull(fieldAlias);
	}
}